package cloud.lysky.java.on.concurrent.thread;

import java.util.concurrent.locks.LockSupport;

/**
 * @author luoly
 * @describe
 * @date 2022-10-18 19:28
 **/
public class LockSupportTest {
    public static void main(String[] args) {
        Thread parkThread = new Thread(new ParkThread());
        parkThread.start();
        System.out.println("唤醒parkThread");
        LockSupport.unpark(parkThread);
    }
}
class ParkThread implements Runnable{

    @Override
    public void run() {
        System.out.println("ParkThread等待许可");
        LockSupport.park();
        System.out.println("ParkThread得到许可继续执行");
    }
}